package git.LiuZhanHong.Demo3_18;
/**
 * @Author Liu Zhanhong
 * @Date 2024/3/18 22:16
 * @Description car子类
 * @Since version-1.0
 */
public class Car2 extends Car{
    public Car2(String name, String color){
        super.setName(name);
        super.setColor(color);
    }

    //重写drive方法
    @Override
    public void drive() {
        super.drive();
        System.out.println("Car2 driving");
    }
    //horn方法重载
    public void horn(int num)
    {
        System.out.println("汽车在"+num+"秒内按了喇叭");
    }
}
